<?php
/**
 *
 * @author		Joachim Ruf, Loresoft Software (http://www.loresoft.de)
 * @license		New BSD License
 * @version		Class for Bootstrap v2.3.2
 *
 * */


Class Bootstrap_Formular_Element
{
	private $arrElement		= array();


	/**
	 * Liefert eine Zeile zurueck.
	 * @param int $i	: Auszugebende Zeile
	 * @return Yapary_Form_Formular_Element
	 * */
	 function __construct($_element, $_desc = NULL, $_prepend = NULL, $_append = NULL) {
		$this->arrElement[]	= array('desc'		=> $_desc,
									'element'	=> $_element,
									'prepend'	=> $_prepend,
									'append'	=> $_append);
	}


	public function display () {
		$content = '';

		if (count($this->arrElement)) {
			foreach ($this->arrElement as $key => $arrVal) {
				$arrClass	= array();
				$arrClass[]	= 'form-inline';
				$prepend	= $arrVal['prepend'];
				$append		= $arrVal['append'];
				$element	= $arrVal['element'];
				$desc		= $arrVal['desc'];

				if ($prepend !== NULL) {
					$arrClass[] = 'input-prepend';
					$prepend = '<span class="add-on">'.$prepend.'</span>';
				}
				if ($append !== NULL) {
					$arrClass[] = 'input-append';
					$append = '<span class="add-on">'.$append.'</span>';
				}
				if ($desc !== NULL) {
					$desc = '<div class="form-horizontal" style="padding-top: 5px;">'.$desc.'</div>';
				}

				$content .= '<div class="" style="float: left;">
								'.$desc.'
								<div class="'.implode(' ', $arrClass).'">
									'.$prepend.$element.$append.'
								</div>
							</div>';
			}
		}

		return $content;
	}

}


?>